package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.Product;
import cn.wolfcode.trip.base.mapper.ProductMapper;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.IProductService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements IProductService {

    @Autowired
    private ProductMapper productMapper;


    @Override
    public int delete(Long id) {
        return 0;
    }

    @Override
    public int insert(Product entity) {
        return 0;
    }

    @Override
    public Product selectByPrimaryKey(Long id) {
        Product product = productMapper.selectByPrimaryKey(id);
        return product;
    }

    @Override
    public List<Product> selectAll() {
        return null;
    }

    @Override
    public int updateByPrimaryKey(Product entity) {
        return 0;
    }

    @Override
    public PageInfo getProductByType(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Product> list = productMapper.selectForList(qo);
        return new PageInfo(list);
    }

    @Override
    public List<Product> selectForList(QueryObject qo) {
        return null;
    }
}
